Skip to main content

All Questions

0votes
1answer
196views

How to determine from the lspci output how cards and how many ports are on a card?

I need to write a script to count how many 2 or 4 port HBA cards we have in each of our servers. I'm running lspci on each of the servers, however, none of the documents I've read so far is telling me ...
Classified's user avatar
0votes
1answer
140views

How does "Useless cat. ... or 'cmd file | ..' instead." should be applied?

I have the following line: isUbuntu=$(cat /etc/os-release | grep '^ID=ubuntu$' | wc -l) It works fine Now, through VSC and mostly with the ShellCheck extension is indicated two warnings messages as ...
Manuel Jordan's user avatar
0votes
1answer
92views

Get a list of all user's commands from a non-interactive shell

I am writing a script that would automatically suggest some new aliases/functions to be added to a user's shell config. Before doing that, however, I would like to make sure the aliases being ...
zoickx's user avatar
0votes
0answers
54views

How to gracefully handle differences in command options between different versions?

Inspired by What is the difference between “base64 -b0” in macOS versions prior to macOS 13 (Ventura) and “base64 -i” in macOS 13 (Ventura)? Are there common ways to avoid the script breaking on a ...
typo's user avatar
  • 239
0votes
1answer
369views

Creating & debug of a bash script menu

I've tried a first time with sh like I refer to in my other post here. I'm trying to run a bash script menu to run from terminal only. #!/bin/bash HEIGHT=800 WIDTH=600 CHOICE_HEIGHT=8 BACKTITLE="...
user avatar
2votes
3answers
3kviews

How do I get the version of a command inside a bash script

So as the question suggests, I want to get the version of a command inside a bash script, instead of using the terminal. I know that all available commands are present as files inside the directory /...
Antas Sharma's user avatar
-2votes
1answer
653views

Redirect the output to two different files, One should have new output whenever the commands execute and the other should have both new & old content

Redirect the output to two different files, One should have new output whenever the commands execute and the other should have both new & old content. For example: openstack port create --network ...
Beginner's user avatar
2votes
1answer
2kviews

What does Session ID mean within the pkill context?

About the pkill command, I know is possible kill processes - for specific scenarios - based through tty[1-6] and pts/[0-N]. I tested and works as expected. Until here all is ok. But now, according ...
Manuel Jordan's user avatar
0votes
0answers
23views

How does Linux create/manage processes assigned through pgid? [duplicate]

I am reading this post: Using job control in the shells About pgid and ppid it indicates: PGID Each process in a process group shares a process group ID (PGID), which is the same as the PID ...
Manuel Jordan's user avatar
0votes
0answers
38views

ShellScript: How to create manually a parent process and their children process? [duplicate]

I am reading this post: Using job control in the shells About ppid it indicates PPID A process that creates a new process is called a parent process; the new process is called a child process. The ...
Manuel Jordan's user avatar
0votes
3answers
240views

How to retrieve the command executed by command substitution for log reports

For Simplicity, consider the following: x=$(java --version) echo "x: $x" It works how expected showing: x: openjdk version "11.0.13" 2021-10-19 OpenJDK Runtime Environment Temurin-...
Manuel Jordan's user avatar
3votes
1answer
2kviews

Run command after prompt

I created a flirt.sh script which just outputs a random sentence with a random color, and now I want it to be ran every time I enter a command I used trap "~/flirt.sh" DEBUG in .bashrc for ...
xezo360hye's user avatar
0votes
1answer
619views

`type` command inside bash script, is not showing all paths

When I type echo "${PATH}" | tr -s ':' '\n' | nl from inside a bash script and at the terminal I get the same result: 1 /home/nikhil/Documents/Git/Cs/Architecture/bin 2 /home/...
Porcupine's user avatar
0votes
1answer
1kviews

Unable to transfer file from Linux to Windows machine with scp

Through Shell script, I've to transfer files/directories from Linux machine to Windows shared location hence tried with following command - scp <directory-location-path-on-linux>/pom.xml "\\...
Alpha's user avatar
-4votes
2answers
227views

Unix command sed replace in a variable

I want to remove brackets [] and quotes around each value and add quotes at start and end. X= ['8922','9292','3220'] I want output as below. Y = '8922,9292,3220' How can I do this. Please suggest.
wlg's user avatar

153050per page
close